package model.altarica_fields;

public class VarType {
	
	public static final int BOOL     = 0;
	public static final int INTEGER  = 1;
	public static final int INTERVAL = 2;
	public static final int ENUM     = 3;
	public static final int DOMAIN   = 4;
	
	private int type;
	
	private IntervalType interval;
	private EnumType enumeration;
	
	private String domain;
	
	public VarType() {
		
		this.type = BOOL;
		this.interval = null;
		this.enumeration = null;
		this.domain = null;
	}
	
	public void setType(IntervalType interval){
		
		this.type = VarType.INTERVAL;
		this.interval = interval;
		this.enumeration = null;
		this.domain = null;
	}
	
	public void setType(EnumType enumeration){
		
		this.type = VarType.ENUM;
		this.enumeration = enumeration;
		this.interval = null;
		this.domain = null;
	}
	
	public void setType(int type){
		
		this.type = type;
		this.interval = null;
		this.enumeration = null;
		this.domain = null;
	}
	
	public void setType(String domain) {
		
		this.domain = domain;
		
		this.type = DOMAIN;
		this.interval = null;
		this.enumeration = null;
	}
	
	public int getVarType() {
		
		return this.type;
	}
	
	public String getDomain() {
		
		return this.domain;
	}
	
	public String toString(){
		
		if (type == BOOL)
			return "BOOL";
		if (type == INTEGER)
			return "INTEGER";
		if (type == INTERVAL)
			return interval.toString();
		
		return enumeration.toString();
	}
}
